package com.check.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.check.dao.MarkTableDao;
import com.check.pojo.MarkTable;
import com.check.pojo.MarkTableMeasure;
import com.check.pojo.MarkTableRule;

@Repository("markTableDao")
public class MarkTableDaoImpl extends BaseSqlMapDao implements MarkTableDao{

	public List<MarkTable> findAllTable(Map map) {
		
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllTableByPage",map);
	}

	public int findTableCount() {
		
		return ((Integer) getSqlMapClientTemplate().queryForObject("MarkTable.findTableCount")).intValue();
	}

	public MarkTable findTableById(String tbId) {
		return (MarkTable) getSqlMapClientTemplate().queryForObject("MarkTable.findTableById",tbId);
	}

	public void insertMarkTable(MarkTable markTable) {
		insertObject("MarkTable.insertMarkTable", markTable);
	}
	
	public void deleteMarkTable(String tbId)  {
		deleteObject("MarkTable.deleteMarkTable", tbId);
	}
	
	public void deleteAllMarkMeasureByTbId(String tbId){
		deleteObject("MarkTable.deleteAllMarkMeasureByTbId", tbId);
	}
	
	public void updateMarkTable(MarkTable markTable)  {
		updateObject("MarkTable.updateMarkTable", markTable);
	}

	public List<MarkTableMeasure> findAllMeasure(Map map) {
		//findAllMeasure
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllMeasureByPage",map);
	}

	public int findMeasureCount(String tbId) {
		return ((Integer) getSqlMapClientTemplate().queryForObject("MarkTable.findMeasureCount",tbId)).intValue();
	}

	public void insertMarkTableMeasure(MarkTableMeasure markTableMeasure) {
		insertObject("MarkTable.insertMarkTableMeasure", markTableMeasure);
	}

	public List<MarkTableMeasure> findAllMeasure(String tbId) {
		
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllMeasure",tbId);
	}

	public List<MarkTable> findAllActiveTable() {
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllActiveTable");
	}

	public List<MarkTableRule> findAllMarkTableRule(String tbId) {
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllMarkTableRule",tbId);
	}

	public void insertMarkTableRule(MarkTableRule markTableRule) {
		insertObject("MarkTable.insertMarkTableRule", markTableRule);
	}

	public void deleteMarkTableRule(String tbId) {
		deleteObject("MarkTable.deleteMarkTableRule", tbId);
	}

	public List<MarkTableRule> findAllMarkTableDetailRule(String tbId) {
		return getSqlMapClientTemplate().queryForList("MarkTable.findAllMarkTableDetailRule",tbId);
	}


}
